#include<stdio.h>
#include<string.h>

int main()
{
   /*输入一个字符串看这个字符串中字母出现的个数*/
   char buffer[32] = {0};
   printf("please input a string:");
   scanf("%s",buffer);

   char searchCh = '0';
   printf("please input a ch:");
   /*%c遇到了%s会有一个回车符需要空格把它杠掉*/
   scanf(" %c",&searchCh);

   printf("buffer:%s\tsearchCh = %c\n",buffer,searchCh);
   
   int count = 0 ;
   for (int idx = 0;idx < strlen(buffer);idx++)
   {
       if (buffer[idx] == searchCh)
       {
           count++;
           printf("buffer[%d] = %c\n", idx, buffer[idx]);
       }
   }
   printf("count = %d\n",count);
   return 0;  
}